package com.scuvc.service.impl;

import com.scuvc.entity.RecordInfo;
import com.scuvc.service.RecordInfoService;
import com.scuvc.utils.StaticUtils;

import java.util.Date;
import java.util.List;

public class RecordInfoServiceImpl implements RecordInfoService {
    @Override
    public int rentCar(RecordInfo recordInfo) {
        return StaticUtils.recordInfoDao.insert(recordInfo);
    }

    @Override
    public List<RecordInfo> queryRecordInfoByUserIdNoReturn(Long userId) {
        return StaticUtils.recordInfoDao.queryRecordInfoByUserIdNoReturn(userId);
    }

    @Override
    public RecordInfo queryRecordInfoByUserIdNoReturnQuery(Long userId) {
        List<RecordInfo> list = StaticUtils.recordInfoDao.queryRecordInfoByUserIdNoReturn(userId);
        if(list!=null && list.size()>0){
            return list.get(0);
        }
        return null;
    }

    @Override
    public List<RecordInfo> queryRecordInfoByUserId(Long userId) {
        return StaticUtils.recordInfoDao.queryRecordInfoByUserId(userId);
    }

    @Override
    public List<RecordInfo> queryRecordInfoByUserIdPage(Long userId, int pageNumber, int pageSize) {
        return StaticUtils.recordInfoDao.queryRecordInfoByUserIdPage(userId,pageNumber,pageSize);
    }

    @Override
    public RecordInfo queryRecordInfoById(Long id) {
        List<RecordInfo> list = StaticUtils.recordInfoDao.queryRecordInfoById(id);
        if(list!=null && list.size()>0){
            return list.get(0);
        }
        return null;
    }

    @Override
    public List<RecordInfo> queryRecordInfoByUserIdByCarNo(Long userId, String carNo) {
        return StaticUtils.recordInfoDao.queryRecordInfoByUserIdByCarNo(userId,carNo);
    }

    @Override
    public List<RecordInfo> queryRecordInfoByUserIdByCarNo(Long userId, String carNo, int pageNumber, int pageSize) {
        return StaticUtils.recordInfoDao.queryRecordInfoByUserIdByCarNo(userId,carNo,
                pageNumber,pageSize);
    }

    @Override
    public int update(Date return_date, Long rent_amount, Long id, String carNo) {
        return StaticUtils.recordInfoDao.update(return_date,rent_amount,id,carNo);
    }
}
